package com.db.gallery


class Project {
	
	static hasMany = [images: ProjectImage]
	static mappedBy = [images: "project"]
	
	String name
	String description
	ProjectGroup projectGroup
	String thumbnailPath
	
	Project(def aName, def aDescription, def aProjectGroup) {
		name = aName
		description = aDescription
		projectGroup = aProjectGroup
		thumbnailPath = "C:/images/revision/default-thumbnail.png"
	}
	
	Project(def aName, def aDescription, def aProjectGroup, def aThumbnailPath) {
		name = aName
		description = aDescription
		projectGroup = aProjectGroup
		thumbnailPath = aThumbnailPath
	}
	
	static mapping = {
		images sort: 'id', order: 'desc', cascade: 'all-delete-orphan'
	}
	
	static constraints = {
		description(maxSize: 5000)
	}

}
